﻿using GameFramework.common;
using GameFramework.UI;
using UnityEngine;
using UnityEngine.UIElements;

namespace Game.ui
{
    public class TestContainerView:BaseView
    {

        [UIBind(Name = "bt")]
        private Button bt;
        
        [UIBind(Name = "md")]
        private Button md;
        
        [UIBind(Name = "tp")]
        private Button tp;

        [UIBind(Name = "Top")]
        private VisualElement top;
        
        
        public override void init()
        {
            base.init();
            // top.pickingMode = PickingMode.Ignore;
            bt.clicked += () =>
            {
                Debug.Log("bt被点击了");
            };
            md.clicked += () =>
            {
                Debug.Log("md被点击了");
            };
            
            tp.clicked += () =>
            {
                Debug.Log("tp被点击了");
                Rect tpLocalBound = tp.localBound;
                Debug.Log("local:"+tpLocalBound.x+","+tpLocalBound.y+","+tpLocalBound.width+","+tpLocalBound.height);
                Rect tpWorldBound = tp.worldBound;
                Debug.Log("world:"+tpWorldBound.x+","+tpWorldBound.y+","+tpWorldBound.width+","+tpWorldBound.height);
                Rect toWorld = tp.LocalToWorld(tpLocalBound);
                Debug.Log("toWorld:" + toWorld.x + "," + toWorld.y + "," + toWorld.width + "," + toWorld);
            };
        }
    }
}